// utils/request.js

const BASE_URL = 'http://127.0.0.1:5000' // ⚠️注意：真机调试改成你电脑的局域网IP

export const request = (url, method = 'GET', data = {}) => {
  return new Promise((resolve, reject) => {
    uni.request({
      url: BASE_URL + url,
      method,
      data,
      success: (res) => {
        resolve(res.data)
      },
      fail: (err) => {
        uni.showToast({ title: '网络错误', icon: 'none' })
        reject(err)
      }
    })
  })
}


